import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { PortalComponent } from "./pages/portal/portal.component";
import { PrefaceComponent } from "./pages/preface/preface.component";
import { DeterminantComponent } from "./pages/determinant/determinant.component";
import { MatrixComponent } from "./pages/matrix/matrix.component";
import { VectorGroupComponent } from "./pages/vector-group/vector-group.component";
import { LinearEquationComponent } from "./pages/linear-equation/linear-equation.component";
import { EigenvalueAndEigenvectorComponent } from "./pages/eigenvalue-and-eigenvector/eigenvalue-and-eigenvector.component";
import { QuadraticFormComponent } from "./pages/quadratic-form/quadratic-form.component";
import { LoginComponent } from "./pages/login/login.component";
import { AuthGuard } from "./guards/auth.service";

const routes: Routes = [
  { path: 'login', component: LoginComponent },
  { path: '', redirectTo: '/portal', pathMatch: 'full' },
  { path: 'portal', component: PortalComponent , data: { title: '线性代数学习网站' }, canActivate: [AuthGuard]},
  { path: 'preface', component: PrefaceComponent , data: {title: '序言'}, canActivate: [AuthGuard]},
  { path: 'determinant', component: DeterminantComponent , data: {title: '行列式'}, canActivate: [AuthGuard]},
  { path: 'matrix', component: MatrixComponent , data: {title: '矩阵'}, canActivate: [AuthGuard]},
  { path: 'vector_group', component: VectorGroupComponent , data: {title: '向量组'}, canActivate: [AuthGuard]},
  { path: 'linear_equation', component: LinearEquationComponent , data: {title: '线性方程式'}, canActivate: [AuthGuard]},
  { path: 'eigenvalue_and_eigenvector', component: EigenvalueAndEigenvectorComponent , data: {title: '特征值与特征向量'}, canActivate: [AuthGuard]},
  { path: 'quadratic_form', component: QuadraticFormComponent , data: {title: '二次型'}, canActivate: [AuthGuard]},
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
